<?php
//这是系统开关的控制器
require('connect.sql.php');
require('sql.function.php');
session_start();
$power=1;
if(isset($_SESSION['userid'])){
	$power=getdataf('duty',"usertable","userid",$_SESSION['userid']);
}
else{
	echo "NO";
}

if($power==0){

	if($_POST['sysgn']==1){
		//系统开启
		$query="update app_user,app_user_sup set app_user.appraisaled=1,app_user_sup.appraisaled=1";
		mysql_query($query)or die(mysql_error());
		echo "OK";
	}
	else if($_POST['sysgn']==2){
		//系统关闭
		$query="update app_user,app_user_sup set app_user.appraisaled=0,app_user_sup.appraisaled=0";
		mysql_query($query)or die(mysql_error());
		echo "OK";
	}
	else if($_POST['sysgn']==3){
		//系统重置
	}
}
else{
	echo "NO";
}
?>